/*
csyingwu
*/
using System;
using System.Collections;
using System.Collections.Generic;

namespace Kaidou.Model
{

	/// <summary>
	/// ITrnPurchSeal interface for NHibernate mapped table 'trn_purch_seal'.
	/// </summary>
	public interface ITrnPurchSeal
	{
		#region Public Properties
		
		int SealNoId
		{
			get ;
			set ;
		}
		
		string SealNo
		{
			get ;
			set ;
		}
		
		string UnionCode
		{
			get ;
			set ;
		}
		
		short BranchCode
		{
			get ;
			set ;
		}
		
		string TraderRegNo
		{
			get ;
			set ;
		}
		
		string JuchuNo
		{
			get ;
			set ;
		}
		
		int ReportQty
		{
			get ;
			set ;
		}
		
		string PurchSts
		{
			get ;
			set ;
		}
		
		DateTime RegDate
		{
			get ;
			set ;
		}
		
		DateTime UpdDate
		{
			get ;
			set ;
		}
		
		string UpdUnionCode
		{
			get ;
			set ;
		}
		
		short UpdBranchCode
		{
			get ;
			set ;
		}
		
		string UpdFuncId
		{
			get ;
			set ;
		}
		
		bool IsDeleted { get; set; }
		bool IsChanged { get; set; }
		
		#endregion 
		#region Serialize
		/// <summary>
		/// Method for entity class serialization to XML file
		/// </summary>
		/// <param name="pXMLFilePath">Path of the XML file to write to. Will be overwritten if already exists.</param>
		void SerializeToFile( string pXMLFilePath );
		
		/// <summary>
		/// Method for entity class deserialization from XML file. Does not change this object content but returns another deserialized object instance
		/// </summary>
		/// <param name="pXMLFilePath">Path of the XML file to read from.</param>
		/// <returns>TrnPurchSeal object restored from XML file</returns>
		TrnPurchSeal DeserializeFromFile( string pXMLFilePath );
		
		#endregion
		
		
	}

	/// <summary>
	/// TrnPurchSeal object for NHibernate mapped table 'trn_purch_seal'.
	/// </summary>
	[Serializable]
	public class TrnPurchSeal : ITrnPurchSeal
	{
		#region Member Variables
        public static string STATUS_NORMAL = "10";
        public static string STATUS_CANSEL = "90";

		protected int _sealNoId;
		protected string _sealNo;
		protected string _unionCode;
		protected short _branchCode;
		protected string _traderRegNo;
		protected string _juchuNo;
		protected int _reportQty;
		protected string _purchSts;
		protected DateTime _regDate;
		protected DateTime _updDate;
		protected string _updUnionCode;
		protected short _updBranchCode;
		protected string _updFuncId;
		protected bool _isDeleted;
		protected bool _isChanged;
		#endregion
		
		#region Constructors
		public TrnPurchSeal() {}
		
		public TrnPurchSeal(int sealNoId, string sealNo, string unionCode, short branchCode, string traderRegNo, string juchuNo, int reportQty, string purchSts, DateTime regDate, DateTime updDate, string updUnionCode, short updBranchCode, string updFuncId)
		{
			this._sealNoId = sealNoId; /*c*/ 
			this._sealNo = sealNo; /*c*/ 
			this._unionCode = unionCode; /*c*/ 
			this._branchCode = branchCode; /*c*/ 
			this._traderRegNo = traderRegNo; /*c*/ 
			this._juchuNo = juchuNo; /*c*/ 
			this._reportQty = reportQty; /*c*/ 
			this._purchSts = purchSts; /*c*/ 
			this._regDate = regDate; /*c*/ 
			this._updDate = updDate; /*c*/ 
			this._updUnionCode = updUnionCode; /*c*/ 
			this._updBranchCode = updBranchCode; /*c*/ 
			this._updFuncId = updFuncId; /*c*/ 
		}
		
		#endregion
		
		
		
		#region Public Properties
		
		public int SealNoId
		{
			get { return _sealNoId; }
			set { _isChanged |= (_sealNoId != value); _sealNoId = value; }
		}
		
		public string SealNo
		{
			get { return _sealNo; }
			set { _isChanged |= (_sealNo != value); _sealNo = value; }
		}
		
		public string UnionCode
		{
			get { return _unionCode; }
			set { _isChanged |= (_unionCode != value); _unionCode = value; }
		}
		
		public short BranchCode
		{
			get { return _branchCode; }
			set { _isChanged |= (_branchCode != value); _branchCode = value; }
		}
		
		public string TraderRegNo
		{
			get { return _traderRegNo; }
			set { _isChanged |= (_traderRegNo != value); _traderRegNo = value; }
		}
		
		public string JuchuNo
		{
			get { return _juchuNo; }
			set { _isChanged |= (_juchuNo != value); _juchuNo = value; }
		}
		
		public int ReportQty
		{
			get { return _reportQty; }
			set { _isChanged |= (_reportQty != value); _reportQty = value; }
		}
		
		public string PurchSts
		{
			get { return _purchSts; }
			set { _isChanged |= (_purchSts != value); _purchSts = value; }
		}
		
		public DateTime RegDate
		{
			get { return _regDate; }
			set { _isChanged |= (_regDate != value); _regDate = value; }
		}
		
		public DateTime UpdDate
		{
			get { return _updDate; }
			set { _isChanged |= (_updDate != value); _updDate = value; }
		}
		
		public string UpdUnionCode
		{
			get { return _updUnionCode; }
			set { _isChanged |= (_updUnionCode != value); _updUnionCode = value; }
		}
		
		public short UpdBranchCode
		{
			get { return _updBranchCode; }
			set { _isChanged |= (_updBranchCode != value); _updBranchCode = value; }
		}
		
		public string UpdFuncId
		{
			get { return _updFuncId; }
			set { _isChanged |= (_updFuncId != value); _updFuncId = value; }
		}
		

		public bool IsDeleted
		{
			get { return _isDeleted; }
			set { _isDeleted = value; }
		}
		
		public bool IsChanged
		{
			get { return _isChanged; }
			set { _isChanged = value; }

		}
		
		#endregion 
		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			TrnPurchSeal castObj = null;
			try
			{
				castObj = (TrnPurchSeal)obj;
			} catch(Exception) { return false; } 
			return (castObj != null) &&
				( this._sealNo == castObj.SealNo );
		}
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
		  
			
			int hash = 57; 
			hash = 27 * hash * _sealNo.GetHashCode(); /*c*/
			return hash; 
		}
		#endregion
		
		#region Serialize
		/// <summary>
		/// Method for entity class serialization to XML file
		/// </summary>
		/// <param name="pXMLFilePath">Path of the XML file to write to. Will be overwritten if already exists.</param>
		public virtual void SerializeToFile( string pXMLFilePath )
		{
			System.Xml.Serialization.XmlSerializer seriliaser = new System.Xml.Serialization.XmlSerializer( this.GetType() );
			using(System.IO.TextWriter txtWriter = new System.IO.StreamWriter( pXMLFilePath ))
			{
				seriliaser.Serialize(txtWriter, this);
				txtWriter.Close();
			}
		}
		/// <summary>
		/// Method for entity class deserialization from XML file. Does not change this object content but returns another deserialized object instance
		/// </summary>
		/// <param name="pXMLFilePath">Path of the XML file to read from.</param>
		/// <returns>TrnPurchSeal object restored from XML file</returns>
		public virtual TrnPurchSeal DeserializeFromFile( string pXMLFilePath )
		{
			TrnPurchSeal _result = null;
			
			System.Xml.Serialization.XmlSerializer seriliaser = new System.Xml.Serialization.XmlSerializer( this.GetType() );
			using(System.IO.TextReader txtReader = new System.IO.StreamReader( pXMLFilePath ))
			{
				_result = (TrnPurchSeal)seriliaser.Deserialize( txtReader );
				txtReader.Close();
			}
			return _result;
		}
		#endregion
		
		
	}
	
	#region Custom ICollection interface for TrnPurchSeal 

	
	public interface ITrnPurchSealCollection : ICollection
	{
		TrnPurchSeal this[int index]{	get; set; }
		void Add(TrnPurchSeal pTrnPurchSeal);
		void Clear();
	}
	
	[Serializable]
	public class TrnPurchSealCollection : ITrnPurchSealCollection
	{
		private IList<TrnPurchSeal> _arrayInternal;

		public TrnPurchSealCollection()
		{
			_arrayInternal = new List<TrnPurchSeal>();
		}
		
		public TrnPurchSealCollection( IList<TrnPurchSeal> pSource )
		{
			_arrayInternal = pSource;
			if(_arrayInternal == null)
			{
				_arrayInternal = new List<TrnPurchSeal>();
			}
		}

		public TrnPurchSeal this[int index]
		{
			get
			{
				return _arrayInternal[index];
			}
			set
			{
				_arrayInternal[index] = value;
			}
		}

		public int Count { get { return _arrayInternal.Count; } }
		public bool IsSynchronized { get { return false; } }
		public object SyncRoot { get { return _arrayInternal; } }
		public void CopyTo(Array array, int index){ _arrayInternal.CopyTo((TrnPurchSeal[])array, index); }
		public IEnumerator GetEnumerator() { return _arrayInternal.GetEnumerator(); }
		public void Add(TrnPurchSeal pTrnPurchSeal) { _arrayInternal.Add(pTrnPurchSeal); }
		public void Clear() { _arrayInternal.Clear(); }
		public IList<TrnPurchSeal> GetList() { return _arrayInternal; }
	 }
	
	#endregion
}
